import { createSlice } from '@reduxjs/toolkit';

const initialState = {
  value: {
    name: "hello",
    age: 20
  },
};

const counterSlice = createSlice({
  name: 'counter',
  initialState,
  reducers: {
    increment: (state) => {
      state.value = {
        name: "no hello",
        age: 18
      };
    },
    decrement: (state) => {
      alert(JSON.stringify(state.value))
    },
  },
});

export const { increment, decrement } = counterSlice.actions;
export default counterSlice.reducer;
